﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ScoringClient.Notification
{
    public enum NotificationAction
    { 
        Login,
        ScoringCatalog
    }

    public enum NotiParamType
    {
        TaskId,
        ApplyId
    }

    public class NotificationRequest
    {
        public NotificationAction Action { get; set; }

        private Dictionary<NotiParamType, object> parameters;

        public NotificationRequest(NotificationAction action)
        {
            this.Action = action;
        }

        public NotificationRequest(NotificationAction action, Dictionary<NotiParamType, object> parameters)
        {
            this.Action = action;
            this.parameters = parameters;
        }

        public void Add(NotiParamType key, object value)
        {
            if (parameters == null)
            {
                parameters = new Dictionary<NotiParamType, object>();
            }

            if (parameters.ContainsKey(key))
            {
                parameters[key] = value;
            }
            else
            {
                parameters.Add(key, value);
            }
        }

        public void Add(Dictionary<NotiParamType, object> parameters)
        {
            if (parameters == null)
                return;

            foreach (NotiParamType key in parameters.Keys)
            {
                Add(key, parameters[key]);
            }
        }

        public void Remove(NotiParamType key)
        {
            parameters.Remove(key);
        }

        public object Find(NotiParamType key)
        {
            return parameters[key];
        }
    }
}
